﻿@{
    ViewBag.Title = "Index";
}
@using PagedList.Mvc;
@using PagedList;
@model IPagedList<MVC4CodeSamples.Models.Entities.Product>
<link href="/Content/PagedList.css" rel="stylesheet" type="text/css" />
<h2>
    Index</h2>
<p>
    @Html.ActionLink("Create New", "Create")
</p>
@using (Html.BeginForm())
{
    <p>
        Find by name: @Html.TextBox("SearchString")
        <input type="submit" value="Search" />
    </p>
}
<table>
    <tr>
        <th>
            @Html.ActionLink("Name", "IndexSorted", new { sOrder = "desc" })
        </th>
        <th>
            "ProductNumber"
        </th>
        <th>
            "Color"
        </th>
        <th>
            "StandardCost"
        </th>
        <th>
            "ListPrice"
        </th>
        <th>
            "Size"
        </th>
        <th>
            "Weight"
        </th>
        <th>
            "ProductCategory.Name"
        </th>
        <th>
            "ProductModel.Name"
        </th>
        <th>
            "SellStartDate"
        </th>
        <th>
            "SellEndDate"
        </th>
        <th>
            "DiscontinuedDate"
        </th>
        <th>
            "ThumbnailPhotoFileName"
        </th>
        <th>
            "rowguid"
        </th>
        <th>
            "ModifiedDate"
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ProductNumber)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Color)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.StandardCost)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ListPrice)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Size)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Weight)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ProductCategory.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ProductModel.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SellStartDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SellEndDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DiscontinuedDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ThumbnailPhotoFileName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.rowguid)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ModifiedDate)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ProductID }) |
                @Html.ActionLink("Details", "Details", new { id = item.ProductID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.ProductID })
            </td>
        </tr>
    }
</table>
@Html.PagedListPager((IPagedList)Model, page => Url.Action("PagedSearch", new { page }))
<a href="https://github.com/TroyGoode/PagedList">https://github.com/TroyGoode/PagedList</a>